package com.lefevre.cms.bean.membershipCard;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 会员卡赠送项
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("membership_card_gift_item")
@Entity
@Table(name = "membership_card_gift_item", indexes = {@Index(name = "membership_card_gift_item_idx", columnList = "membershipCardGiftTaskId")})
public class MembershipCardGiftItem implements Serializable {

    private static final long serialVersionUID = 5510904045129099287L;

    /**
     * Id  格式: 会员卡赠送任务Id- 用户Id
     **/
    @Id
    @Column(length = 65)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 任务类型 10:长期  20:一次性
     **/
    @TableField("type")
    protected Integer type = 10;

    /**
     * 会员卡赠送任务Id
     **/
    @TableField("membershipCardGiftTaskId")
    protected Long membershipCardGiftTaskId;

    /**
     * 呢称
     **/
    @Transient
    @TableField(exist = false)
    protected String nickname;

    /**
     * 头像路径
     **/
    @Transient
    @TableField(exist = false)
    protected String avatarPath;

    /**
     * 头像名称
     **/
    @Transient
    @TableField(exist = false)
    protected String avatarName;

    /**
     * 用户名称
     **/
    @Column(length = 30)
    @TableField("userName")
    protected String userName;

    /**
     * 赠送时间
     **/
    @TableField("postTime")
    @Temporal(TemporalType.TIMESTAMP)
    protected Date postTime = new Date();

    /**
     * 赠送时长
     **/
    @TableField("duration")
    protected Integer duration;

    /**
     * 赠送时长时长单位 10.小时 20.日 30.月 40.年
     **/
    @TableField("unit")
    protected Integer unit;

    /**
     * 限制条件 restrictionGroupList值的json格式字符
     **/
    @Lob
    @TableField("restriction")
    private String restriction;

    /**
     * 限制条件组集合
     **/
    @Transient
    @TableField(exist = false)
    private RestrictionGroup restrictionGroup = new RestrictionGroup();

}
